
sampler TextureSampler : register(s0);
const float blurSize = 1.0/512.0;
//const float blurSize = 1.0/200.0;
float4 horizontal(float4 color : COLOR0, float2 vTexCoord : TEXCOORD0) : COLOR0
{
   float4 sum = float4(0,0,0,0);
 
   // blur in y (vertical)
   // take nine samples, with the distance blurSize between them
   sum += tex2D(TextureSampler, float2(vTexCoord.x, vTexCoord.y - 4.0*blurSize)) * 0.05;
   sum += tex2D(TextureSampler, float2(vTexCoord.x, vTexCoord.y - 3.0*blurSize)) * 0.09;
   sum += tex2D(TextureSampler, float2(vTexCoord.x, vTexCoord.y - 2.0*blurSize)) * 0.12;
   sum += tex2D(TextureSampler, float2(vTexCoord.x, vTexCoord.y - blurSize)) * 0.15;
   sum += tex2D(TextureSampler, float2(vTexCoord.x, vTexCoord.y)) * 0.16;
   sum += tex2D(TextureSampler, float2(vTexCoord.x, vTexCoord.y + blurSize)) * 0.15;
   sum += tex2D(TextureSampler, float2(vTexCoord.x, vTexCoord.y + 2.0*blurSize)) * 0.12;
   sum += tex2D(TextureSampler, float2(vTexCoord.x, vTexCoord.y + 3.0*blurSize)) * 0.09;
   sum += tex2D(TextureSampler, float2(vTexCoord.x, vTexCoord.y + 4.0*blurSize)) * 0.05;
 
   return sum * 2;
}

float4 vertical(float4 color : COLOR0, float2 vTexCoord : TEXCOORD0) : COLOR0
{
   float4 sum = float4(0,0,0,0);
 
   // blur in y (vertical)
   // take nine samples, with the distance blurSize between them
   sum += tex2D(TextureSampler, float2(vTexCoord.x - 4.0*blurSize, vTexCoord.y)) * 0.05;
   sum += tex2D(TextureSampler, float2(vTexCoord.x - 3.0*blurSize, vTexCoord.y)) * 0.09;
   sum += tex2D(TextureSampler, float2(vTexCoord.x - 2.0*blurSize, vTexCoord.y)) * 0.12;
   sum += tex2D(TextureSampler, float2(vTexCoord.x - blurSize, vTexCoord.y)) * 0.15;
   sum += tex2D(TextureSampler, float2(vTexCoord.x, vTexCoord.y)) * 0.16;
   sum += tex2D(TextureSampler, float2(vTexCoord.x + blurSize, vTexCoord.y)) * 0.15;
   sum += tex2D(TextureSampler, float2(vTexCoord.x + 2.0*blurSize, vTexCoord.y)) * 0.12;
   sum += tex2D(TextureSampler, float2(vTexCoord.x + 3.0*blurSize, vTexCoord.y)) * 0.09;
   sum += tex2D(TextureSampler, float2(vTexCoord.x + 4.0*blurSize, vTexCoord.y)) * 0.05;
 
   return sum * 2;
}

technique verti
{
	pass Pass1
	{
		PixelShader = compile ps_2_0 vertical();
	}
}

technique horiz
{
    pass Pass1
    {
        PixelShader = compile ps_2_0 horizontal();
    }
}
